<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('编辑帖子')" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-role-edit" th:object="${talk}">
			<input id="talkId" name="talkId" type="hidden" th:field="*{talkId}"/>
			<input id="userId" name="userId" type="hidden" th:field="*{userId}"/>
			<div class="form-group">
				<label class="col-sm-3 control-label ">主题：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="talkCenter" id="talkCenter" th:field="*{talkCenter}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">内容：</label>
				<div class="col-sm-8">
					<textarea class="form-control" type="text" name="talkContent" id="talkContent" th:field="*{talkContent}"
                              style="margin: 0px 12px 0px 0px; width: 461px; height: 344px;" required></textarea>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: ztree-js" />
	<th:block th:include="include :: datetimepicker-js" />
	<script type="text/javascript">
        $(function() {

        });

		function edit() {
			var talkId = $("input[name='talkId']").val();
			var userId = $("input[name='userId']").val();
			var talkCenter = $("input[name='talkCenter']").val();
            var talkContent = $("textarea[name='talkContent']").val();
			$.ajax({
				cache : true,
				type : "POST",
				url : ctx + "sau/mytalk/updateMyTalk",
				data : {
					"talkId": talkId,
					"userId": userId,
					"talkCenter": talkCenter,
					"talkContent": talkContent
				},
				async : false,
				error : function(request) {
					$.modal.alertError("系统错误");
				},
				success : function(data) {
					$.operate.successCallback(data);
				}
			});
		}
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	edit();
	        }
	    }
	</script>
</body>
</html>
